package net.quanter.sample.nacos.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultDTO <T extends Object> implements Serializable {
    private static final long serialVersionUID = 1L;
    int code;
    String message;
    T data;
    boolean success;
    public static ResultDTO success(Object data){
        return new ResultDTO(200,null,data,true);
    }
    public static ResultDTO success(Object data, String messsage){
        return new ResultDTO(200,messsage,data,true);
    }
    public static ResultDTO fail(String message){
        return new ResultDTO(200,message,null,false);
    }
}
